using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
/// Summary description for DataListHelper
/// </summary>
public partial class ControlHelper
{
    public int FillDataTableToDataList(
        DataList dataList)
    {
        int totalRecord = 0;
        DataTable dataTable =
        sqlServerProvider.GetDataTable();
        if (dataTable != null)
        {
            dataList.DataSource = dataTable;
            totalRecord = dataTable.Rows.Count;
        }
        else
            dataList.DataSource = null;
        dataList.DataBind();
        return totalRecord;
    }
    
    public int FillDataTableToDataList(
    DataList dataList, int startRecord, int maxRecord)
    {
        int totalRecord = 0;
        DataTable dataTable =
        sqlServerProvider.GetDataTable(startRecord, maxRecord);
        if (dataTable != null)
        {
            dataList.DataSource = dataTable;
            totalRecord = dataTable.Rows.Count;
        }
        else
            dataList.DataSource = null;
        dataList.DataBind();       
        return totalRecord; 
    }
}
